package com.easybuilder.common.utils;

import java.util.Map;
import java.util.Set;


public class ParamsUtil {

    public static String MapToString(Map map){
        StringBuilder param = new StringBuilder();
        if (map != null && map.size() > 0) {
            Set keys = map.keySet();
            int i = 0;
            for (Object key : keys) {
                if (i==0) {
                    param.append("?");
                }
                param.append(key).append("=").append(map.get(key)).append("&");
                i++;
            }
            param.deleteCharAt(param.lastIndexOf("&"));
        }
        return param.toString();
    }
}
